/**
  ******************************************************************************
  * @file 
  * @brief 
  * @author 
  * @version V1.0.0
  * @date 2019/01/28
  ******************************************************************************
  */
#ifndef _w5500_H
#define _w5500_H

#include "dev_include.h"
#include "common_f4.h"
/* Public defines -----------------------------------------------------------*/

/* Public Struct  -----------------------------------------------------------*/
typedef struct
{
	drv_spi_t 		drv_spix;
	drv_gpio_t 		drv_gpio_spics;
	drv_gpio_t 		drv_gpio_int;
    drv_gpio_t 		drv_gpio_reset;
} w5500_private_t;

typedef struct dev_w5500  dev_w5500_t;

struct dev_w5500
{
    /* ***************Public Parameter  *************** */
	const char *    DRV;            //SPI驱动名称
    const char *    PIN_CS;         //spi_cs-引脚
    const char *	PIN_MOSI;       //spi_mosi-引脚
    const char *	PIN_MISO;       //spi_miso-引脚
    const char *	PIN_SCK;        //spi_sck-引脚
	
    const char *	PIN_INT;        //中断-引脚
    const char *	PIN_RESET;      //复位-引脚

	spi_speed_e 	SPI_SPEED;      //SPI速度
	spi_cs_e    	SPI_CS_MODE;    //SPI CS模式（软件，硬件）
	
	/* ***************Private Method    *************** */

    /* ***************Public Method     *************** */
	void ( *Reset )(void );
	void ( *CSCmd )(bool State);
    /* ***************Private Attributes*************** */
    w5500_private_t    private;

};
/* Public enum    -----------------------------------------------------------*/
typedef enum //RESET状态
{
  CS_ENABLE = 1,
  CS_DISENABLE = 0,
} W5500_CS_e;

/* Public Variable  ---------------------------------------------------------*/
//Pointer

//Array

//Const


/* Pubilc function prototypes -----------------------------------------------*/
//int W5500_Init ( dev_w5500_t* this );
void W5500_Init(void);
void SPI_WriteByte(uint8_t TxData);
uint8_t SPI_ReadByte(void);
void SPI_WriteWord(uint16_t TxData);
uint16_t SPI_ReadWord(void);
void SPI_DMA_WRITE(uint8_t* Addref, uint8_t* pTxBuf, uint16_t tx_len);
void SPI_DMA_READ(uint8_t* Addref, uint8_t* pRxBuf, uint16_t rx_len);

void W5500_CSCmd(int State);
#endif 

/******************* (C) COPYRIGHT 2018 CIQTEK Samuel *****END OF FILE****/



